<template>
  <div class="app-container">

    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="姓名" prop="patName">
        <el-input
            v-model="queryParams.patName"
            placeholder="姓名"
            clearable
            style="width: 200px"
            @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="门诊号" prop="barCode">
        <el-input
            v-model="queryParams.barCode"
            placeholder="门诊号"
            clearable
            style="width: 200px"
            @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item label="门诊科室" prop="wardCode">
        <el-select v-model="queryParams.orgId" filterable clearable  style="width: 200px" @keyup.enter="handleQuery">
          <el-option v-for="dict in sys_mrout" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button type="primary" v-if="false" icon="Plus" @click="handleAdd" v-hasPermi="['by:post:add']">添加
        </el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="postList">
      <el-table-column label="门诊号" align="center" prop="barCode"/>
      <el-table-column label="门诊次数" align="center" prop="outTimes"/>
      <el-table-column label="姓名" align="center" prop="patName"/>
      <el-table-column label="性别" align="center" prop="gender"/>
      <el-table-column label="年龄" align="center" prop="age"/>
      <el-table-column label="类型" align="center" prop="status"/>
      <el-table-column label="门诊时间" align="center" prop="actTime"/>
      <el-table-column label="诊断" align="center" prop="diagnos"/>
      <el-table-column label="类型" align="center" prop="response"/>
      <el-table-column label="出诊医生" align="center" prop="attenderName"/>
      <el-table-column label="门诊科室" align="center" prop="orgName"/>
      <el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
          <!-- <el-button link type="primary" @click="handleDetail(scope.row)">详情</el-button> -->
          <el-button link type="primary" @click="handleDetail(scope.row)">数据管理</el-button>
          <el-button link type="primary" @click="handleOpenCl(scope.row)">数据上传</el-button>
          <!--          <el-button link type="primary" @click="handlexml(scope.row)">数据管理</el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <el-dialog title="数据管理" v-model="open" width="700px" append-to-body>
      <el-form :model="formDetail" label-width="100px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="姓名："><el-input v-model="formDetail.patName"/></el-form-item>
            <el-form-item label="门诊次数："><el-input v-model="formDetail.outTimes"/></el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="性别："><el-input v-model="formDetail.gender"/></el-form-item>
            <el-form-item label="年龄："><el-input v-model="formDetail.age"/></el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="状态："><el-input v-model="formDetail.status"/></el-form-item>
            <el-form-item label="入院时间："><el-input v-model="formDetail.actTime"/></el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="诊断："><el-input v-model="formDetail.diagnos"/></el-form-item>
            <el-form-item label="类型："><el-input v-model="formDetail.response"/></el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="患者号："><el-input v-model="formDetail.patientId"/></el-form-item>
            <el-form-item label="出诊医生："><el-input v-model="formDetail.attenderName"/></el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="handleDetailUpdate()">更 新</el-button>
          <el-button @click="closeDetailDialog()">关 闭</el-button>
        </div>
      </template>
    </el-dialog>

    <pagination
        v-show="total > 0"
        :total="total"
        v-model:page="queryParams.pageNum"
        v-model:limit="queryParams.pageSize"
        @pagination="getList"
    />





    <el-dialog title="数据处理-推送数据" v-model="open_cl" width="100%" append-to-body>

      <template #header>
        <div class="dialog-footer">
          <el-button type="primary" @click="handleUpdate()">全部上传</el-button>
          <el-button type="primary" @click="handleUpdateData()">基础数据上传</el-button>
          <el-button type="primary" @click="handleUpdateLab()">实验室检查数据上传</el-button>
          <el-button type="primary" @click="handleUpdateInspection()">检查数据上传</el-button>
          <el-button @click="closeDetailDialog_cl()">关 闭</el-button>
        </div>
      </template>

      <div class="a4-paper">
        <el-form :model="mrOutBaisc" label-width="150px" size="small">
          <center><h2 >医疗机构 {{mrOutBaisc.organization}}（组织代码：{{mrOutBaisc.organizationId}}）</h2></center>
          <center> <h2>门诊数据</h2></center>
          <el-form-item label="医疗付款方式：" prop="medicalPayment">
            <!--        <input v-model="mrInBaisc.medicalPayment" class="shuru"/>-->
            <el-select v-model="mrOutBaisc.medicalPayment" filterable clearable class="shuru" style="width: 160px;" >
              <el-option v-for="dict in sys_payment" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
            </el-select>
          </el-form-item><br>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr;">
            <el-form-item label="健康卡号：" prop="healthCard">
              <input v-model="mrOutBaisc.healthCard" class="shuru"/>
            </el-form-item>
            <el-form-item label="就医流水号：" prop="healthCard">
              <input v-model="mrOutBaisc.mdtrtsn" disabled class="shuru"/>
            </el-form-item>
            <el-form-item label="门诊号：" prop="healthCard">
              <input v-model="mrOutBaisc.mrId" disabled class="shuru"/>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr;">
            <el-form-item label="姓名" prop="healthCard" label-width="40px">
              <input v-model="mrOutBaisc.name" class="shuru"/>
            </el-form-item>
            <el-form-item label="性别" prop="sex" label-width="40px">
              <!--          <input v-model="mrInBaisc.sex" class="shuru" style="width: 20px;"/>-->
              <el-select v-model="mrOutBaisc.sex" filterable clearable class="shuru" style="width: 60px;" >
                <el-option v-for="dict in sys_user_sex" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="出生日期" prop="healthCard" clearable label-width="60px">
              <!--          <input v-model="mrInBaisc.birthday" class="shuru" style="width: 130px;"/>-->
              <el-date-picker v-model="mrOutBaisc.birthday" type="date" value-format="YYYY/MM/DD" class="shuru" style="width: 130px;" />
            </el-form-item>
            <el-form-item label="年龄" prop="healthCard" label-width="40px">
              <input v-model="mrOutBaisc.ageYear" class="shuru" style="width: 20px;"/>岁
            </el-form-item>
            <el-form-item label="国籍" prop="healthCard" label-width="40px">
              <!--          <input v-model="mrInBaisc.nationality" class="shuru"/>-->
              <el-select v-model="mrOutBaisc.nationality" filterable clearable class="shuru" style="width: 140px;" >
                <el-option v-for="dict in sys_country" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr;">
            <el-form-item label="（年龄不足1周岁的）年龄" prop="healthCard" label-width="160px">
              <input v-model="mrOutBaisc.ageDay" class="shuru"/>天
            </el-form-item>
            <el-form-item label="新生儿出生体重" prop="healthCard">
              <input v-model="mrOutBaisc.weight" class="shuru"/>克
            </el-form-item>
            <el-form-item label="新生儿入院体重" prop="healthCard">
              <input v-model="mrOutBaisc.InWeight" class="shuru"/>克
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr;">
            <el-form-item label="出生地" prop="healthCard" label-width="50px">
              <!--          <input v-model="mrInBaisc.birthPlace" class="shuru" style="width: 250px"/>-->
              <el-select v-model="mrOutBaisc.birthPlace" filterable clearable class="shuru" style="width: 250px;" >
                <el-option v-for="dict in sys_region" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="籍贯" prop="healthCard" label-width="50px">
              <!--          <input v-model="mrInBaisc.nativePlace" class="shuru" style="width: 150px"/>-->
              <el-select v-model="mrOutBaisc.nativePlace" filterable clearable class="shuru" style="width: 200px;" >
                <el-option v-for="dict in sys_region" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="民族" prop="healthCard" label-width="50px">
              <!--          <input v-model="mrInBaisc.nation" class="shuru"/>-->
              <el-select v-model="mrOutBaisc.nation" filterable clearable class="shuru" style="width: 100px;" >
                <el-option v-for="dict in sys_nation" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr;">
            <el-form-item label="身份证号" prop="healthCard" label-width="60px">
              <input v-model="mrOutBaisc.idCard" class="shuru" style="width: 150px"/>
            </el-form-item>
            <el-form-item label="职业" prop="occupation" label-width="50px">
              <!--          <input v-model="mrInBaisc.occupation" class="shuru" style="width: 100px"/>-->
              <el-select v-model="mrOutBaisc.occupation" filterable clearable class="shuru" style="width: 100px;" >
                <el-option v-for="dict in sys_occupation" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="婚姻" prop="healthCard" label-width="50px">
              <!--          <input v-model="mrInBaisc.marriage" class="shuru"/>-->
              <el-select v-model="mrOutBaisc.marriage" filterable clearable class="shuru" style="width: 60px;" >
                <el-option v-for="dict in sys_marriage" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr;">
            <el-form-item label="现住址" prop="healthCard" label-width="50px">
              <input v-model="mrOutBaisc.address" class="shuru" style="width: 200px"/>
            </el-form-item>
            <el-form-item label="电话" prop="healthCard" label-width="50px">
              <input v-model="mrOutBaisc.addrTelephone" class="shuru" style="width: 100px"/>
            </el-form-item>
            <el-form-item label="邮编" prop="healthCard" label-width="50px">
              <input v-model="mrOutBaisc.addrPostcode" class="shuru" style="width: 120px"/>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr;">
            <el-form-item label="户口地址" prop="healthCard" label-width="60px">
              <input v-model="mrOutBaisc.registerPlace" class="shuru" style="width: 400px"/>
            </el-form-item>
            <el-form-item label="邮编" prop="healthCard" label-width="50px">
              <input v-model="mrOutBaisc.registerPostcode" class="shuru" style="width: 120px"/>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr;">
            <el-form-item label="工作单位及地址" prop="healthCard" label-width="100px">
              <input v-model="mrOutBaisc.workUnit" class="shuru" style="width: 200px"/>
            </el-form-item>
            <el-form-item label="单位电话" prop="healthCard" label-width="60px">
              <input v-model="mrOutBaisc.unitTelephone" class="shuru" style="width: 100px"/>
            </el-form-item>
            <el-form-item label="邮编" prop="healthCard" label-width="50px">
              <input v-model="mrOutBaisc.unitPostcode" class="shuru" style="width: 120px"/>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;">
            <el-form-item label="联系人姓名" prop="healthCard" label-width="75px">
              <input v-model="mrOutBaisc.linkman" class="shuru" style="width: 80px"/>
            </el-form-item>
            <el-form-item label="关系" prop="healthCard" label-width="40px">
              <!--        <input v-model="mrInBaisc.relationship" class="shuru" style="width: 60px"/>-->
              <el-select v-model="mrOutBaisc.relationship" filterable clearable class="shuru" style="width: 140px;" >
                <el-option v-for="dict in sys_guanxi" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="地址" prop="healthCard" label-width="50px">
              <input v-model="mrOutBaisc.linkmanAddr" class="shuru" style="width: 200px"/>
            </el-form-item>
            <el-form-item label="电话" prop="healthCard" label-width="40px">
              <input v-model="mrOutBaisc.linkmanTele" class="shuru" style="width: 100px"/>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;">
            <el-form-item label="就诊时间" prop="healthCard" label-width="60px">
              <!--          <input v-model="mrInBaisc.inTime" class="shuru" style="width: 130px;"/>-->
              <el-date-picker v-model="mrOutBaisc.inTime" type="datetime" disabled value-format="yyy-MM-DD T HH:MM:SS" class="shuru" style="width: 140px;" />
            </el-form-item>
            <el-form-item label="就诊科室名称" prop="healthCard" label-width="120px">
              <input v-model="mrOutBaisc.inDepa" disabled class="shuru" style="width: 100px;"/>
            </el-form-item>
            <el-form-item label="诊疗科目" prop="healthCard" label-width="120px">
<!--              <input v-model="mrOutBaisc.standardSubject" disabled class="shuru" style="width: 100px;"/>-->
              <el-select v-model="mrOutBaisc.standardSubject" disabled class="shuru" clearable style="width: 140px;" >
                <el-option v-for="dict in sys_consultation_subject" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="离开门诊方式" prop="healthCard" label-width="85px">
              <!--              <input v-model="mrOutBaisc.standardSubject" disabled class="shuru" style="width: 100px;"/>-->
              <el-select v-model="mrOutBaisc.outWay" disabled class="shuru" clearable style="width: 140px;" >
                <el-option v-for="dict in sys_outway" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr;">
            <el-form-item label="血型" prop="healthCard" label-width="40px">
              <!--              <input v-model="mrInBaisc.abo" class="shuru" style="width: 100px;"/>-->
              <el-select v-model="mrOutBaisc.abo" class="shuru" clearable style="width: 100px;" >
                <el-option v-for="dict in sys_abo" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="Rh" prop="healthCard" label-width="40px">
              <!--              <input v-model="mrInBaisc.rh" class="shuru" style="width: 100px;"/>-->
              <el-select v-model="mrOutBaisc.rh" class="shuru" clearable style="width: 140px;" >
                <el-option v-for="dict in sys_rh" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </div>
          <div>
            <h2>疾病诊断</h2>
            <el-table v-loading="loading" :data="mrOutDiagnosss">
              <el-table-column label="诊断类型"  align="center" prop="diagType">
                <template #default="scope">
                  <dict-tag :options="sys_diag_type" :value="scope.row.diagType" />
                </template>
              </el-table-column>
              <el-table-column label="疾病诊断名称"  align="center" prop="diagnoss"/>
              <el-table-column label="疾病编码"  align="center" prop="diagCode"/>
              <el-table-column label="入院病情"  align="center" prop="status"/>
              <el-table-column label="治疗结果"  align="center" prop="treatmentResults"/>
              <el-table-column label="诊治"  align="center" prop="diagTreatment"/>
            </el-table>
          </div>
        </el-form>
        <h2>门诊记录</h2>
        <el-form :model="mrOutRecord" label-width="100px">
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr;">
            <el-form-item label="门诊科室名称：" prop="depaName" label-width="120px">
              {{ mrOutRecord.depaName }}
            </el-form-item>
            <el-form-item label="门诊时间：" prop="inTime" label-width="90px">
              <!--          {{mrInRecord.inTime}}-->
              <el-date-picker v-model="mrOutRecord.inTime" type="datetime" class="shuru" style="width: 150px;" />
            </el-form-item>
            <el-form-item label="记录时间：" prop="recordTime" label-width="90px">
              <!--          {{mrInRecord.recordTime}}-->
              <el-date-picker v-model="mrOutRecord.recordTime" type="datetime" class="shuru" style="width: 150px;" />
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;">
            <el-form-item label="病情陈述者：" prop="representor" label-width="110px">
              {{ mrOutRecord.representor }}
            </el-form-item>
            <el-form-item label="亲属关系：" prop="relationship" label-width="90px">
              {{mrOutRecord.relationship}}
            </el-form-item>
            <el-form-item label="电话：" prop="telephone" label-width="90px">
              {{mrOutRecord.telephone}}
            </el-form-item>
            <el-form-item label="可靠程度：" prop="reliability" label-width="90px">
              {{mrOutRecord.reliability}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="地址：" prop="address" label-width="90px">
              {{mrOutRecord.address}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="主诉：" prop="chiefComplaints" label-width="90px">
              {{mrOutRecord.chiefComplaints}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="现病史：" prop="illnessHistory" label-width="90px">
              {{mrOutRecord.illnessHistory}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="既往史：" prop="pastHistory" label-width="90px">
              {{mrOutRecord.pastHistory}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="个人史：" prop="personalHistory" label-width="90px">
              {{mrOutRecord.personalHistory}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="婚姻史：" prop="maritalHistory" label-width="90px">
              {{mrOutRecord.maritalHistory}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="家族史：" prop="familyHistory" label-width="90px">
              {{mrOutRecord.familyHistory}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="体格检查：" prop="medicalExamination" label-width="90px">
              {{mrOutRecord.medicalExamination}}
            </el-form-item>
          </div>
          <div style="display: grid; grid-template-columns: 1fr;">
            <el-form-item label="辅助检查：" prop="accessoryExamination" label-width="90px">
              {{mrOutRecord.accessoryExamination}}
            </el-form-item>
          </div>
        </el-form>
        <div>
          <center><h2>门诊医嘱数据</h2></center>
          <el-table v-loading="loading" :data="mrOutOrders" height="500">
            <el-table-column label="医嘱号"  align="center" prop="orderNo"/>
            <el-table-column label="医嘱名称"  align="center" prop="orderName"/>
            <el-table-column label="下达科室"  align="center" prop="orderDepa"/>
            <el-table-column label="下达医师"  align="center" prop="orderDoctor"/>
            <el-table-column label="医嘱下达时间"  align="center" prop="orderTime"/>
            <el-table-column label="执行科室"  align="center" prop="implementDepa"/>
            <el-table-column label="执行人"  align="center" prop="executor"/>
            <el-table-column label="审核人"  align="center" prop="checked"/>
            <el-table-column label="医嘱组号"  align="center" prop="orderGrouping"/>
            <el-table-column label="医嘱类别"  align="center" prop="orderType"/>
            <el-table-column label="医嘱项目分类字典表"  align="center" prop="orderClassification"/>
            <el-table-column label="医嘱明细代码"  align="center" prop="orderCode"/>
            <el-table-column label="药物类型"  align="center" prop="drugType"/>
            <el-table-column label="药物剂型"  align="center" prop="drugDosageform"/>
            <el-table-column label="药品规格"  align="center" prop="drugSpecifications"/>
            <el-table-column label="数量"  align="center" prop="drugNumber"/>
            <el-table-column label="药物使用频率"  align="center" prop="drugFrequency"/>
            <el-table-column label="药物使用一次剂量"  align="center" prop="drugDosage"/>
            <el-table-column label="药物使用剂量单位"  align="center" prop="drugUseUnit"/>
            <el-table-column label="总剂量"  align="center" prop="drugIntegraldose"/>
            <el-table-column label="途径"  align="center" prop="drugRoute"/>
            <el-table-column label="用药天数"  align="center" prop="drugDay"/>
            <el-table-column label="执行时间"  align="center" prop="executionTime"/>
            <el-table-column label="开始时间"  align="center" prop="startTime"/>
            <el-table-column label="用药停止时间"  align="center" prop="stopTime"/>
            <el-table-column label="皮试"  align="center" prop="skinTest"/>
            <el-table-column label="医嘱取消时间"  align="center" prop="cancelTime"/>
            <el-table-column label="停止医嘱医师"  align="center" prop="stopDoctor"/>
          </el-table>
        </div>
        <div>
          <center><h2>门诊体征数据</h2></center>
          <el-table v-loading="loading" :data="mrOutPhysicalsigns" height="500">
            <el-table-column label="门诊科室"  align="center" prop="depaId"/>
            <el-table-column label="就诊日期"  align="center" prop="inTime"/>
            <el-table-column label="住院体温单编号"  align="center" prop="tNo"/>
            <el-table-column label="日体温单编号"  align="center" prop="tNoDay"/>
            <el-table-column label="时刻体温单编号"  align="center" prop="tNoTime"/>
            <el-table-column label="测量时间"  align="center" prop="tTime"/>
            <el-table-column label="住院天数"  align="center" prop="hosDay"/>
            <el-table-column label="手术后天数"  align="center" prop="opsDay"/>
            <el-table-column label="液体入量(ml/日)"  align="center" prop="infusion"/>
            <el-table-column label="尿量出量(ml/日)"  align="center" prop="upd"/>
            <el-table-column label="痰量出量(ml/日)"  align="center" prop="sputum"/>
            <el-table-column label="呕吐量出量(ml/日)"  align="center" prop="vomiting"/>
            <el-table-column label="引流量出量(ml/日)"  align="center" prop="drainage"/>
            <el-table-column label="其他液体排出量(ml/日)"  align="center" prop="other"/>
            <el-table-column label="液体总排出量(ml/日)"  align="center" prop="ejection"/>
            <el-table-column label="大便失禁"  align="center" prop="encopresis"></el-table-column>
            <el-table-column label="大便次数"  align="center" prop="shitNumber"/>
            <el-table-column label="导尿"  align="center" prop="catheterization"></el-table-column>
            <el-table-column label="卧床"  align="center" prop="sickbed"></el-table-column>
            <el-table-column label="体重(kg)"  align="center" prop="weight"/>
            <el-table-column label="身高(cm)"  align="center" prop="height"/>
            <el-table-column label="腹围"  align="center" prop="ac"/>
            <el-table-column label="收缩压(mmHg)"  align="center" prop="sbp"/>
            <el-table-column label="舒张压(mmHg)"  align="center" prop="dbp"/>
            <el-table-column label="脉搏短绌"  align="center" prop="pulseDeficit"></el-table-column>
            <el-table-column label="心率(次/分钟)"  align="center" prop="pulserate"/>
            <el-table-column label="使用心脏起搏器"  align="center" prop="usingPump"></el-table-column>
            <el-table-column label="呼吸次数(次/分钟)"  align="center" prop="respiratoryRate"/>
            <el-table-column label="使用呼吸机"  align="center" prop="usingRespirators"></el-table-column>
            <el-table-column label="体温(℃)"  align="center" prop="temperature"/>
            <el-table-column label="物理降温"  align="center" prop="physicalCooling"></el-table-column>
            <el-table-column label="降温处理后体温(℃)"  align="center" prop="pcTemperature"/>
            <el-table-column label="血氧饱和度"  align="center" prop="oxygenSaturation"/>
            <el-table-column label="护士姓名"  align="center" prop="nurse"/>
            <el-table-column label="护士身份证号码"  align="center" prop="nurseId"/>
          </el-table>
        </div>
        <div>
          <center><h2>实验室检查报告</h2></center>
          <el-table  v-loading="loading" :data="mrInlab" height="500">
            <el-table-column  label="病案号" align="center" prop="mrId"/>
            <el-table-column  label="医嘱号" align="center" prop="orderNo"/>
            <el-table-column  label="报告单号" align="center" prop="reportNo"/>
            <el-table-column  label="检查时间" align="center" prop="inspectTime"/>
            <el-table-column  label="检查项目代码" align="center" prop="inspectCode"/>
            <el-table-column  label="检查项目名称" align="center" prop="inspectName"/>
            <el-table-column  label="检验结果" align="center" prop="inspectResult"/>
            <el-table-column  label="检查计量单位" align="center" prop="measurementUnit"/>
            <el-table-column  label="正常值上限" align="center" prop="referenceToplimit"/>
            <el-table-column  label="正常值下限" align="center" prop="referenceLowerlimit"/>
            <el-table-column  label="参考值" align="center" prop="referenceValue"/>
            <el-table-column  label="检查科室" align="center" prop="inspectDepa"/>
            <el-table-column  label="检查人姓名" align="center" prop="rapporteur"/>
            <el-table-column  label="审核人姓名" align="center" prop="checked"/>
          </el-table>
        </div>
        <div>
          <center><h2>检查报告</h2></center>
          <el-table v-loading="loading" :data="mrInspection" height="500">
            <el-table-column label="病案号" align="center" prop="mrId" width="80px"/>
            <el-table-column label="报告单号" align="center" prop="reportNo" width="80px"/>
            <el-table-column label="检查时间" align="center" prop="inspectTime" width="130px"/>
            <el-table-column label="检查目的" align="center" prop="inspectObjective" width="80px"/>
            <el-table-column label="检查项目名称" align="center" prop="inspectName"/>
            <el-table-column label="检查部位" align="center" prop="inspectPosition"/>
            <el-table-column label="检查方法" align="center" prop="inspectMethod" width="80px"/>
            <el-table-column label="检查结果" align="center" prop="inspectResult"/>
            <el-table-column label="检查人姓名" align="center" prop="rapporteur" width="80px"/>
            <el-table-column label="审核人姓名" align="center" prop="checked" width="80px" />
            <el-table-column label="云浏览链接" align="center" prop="cloudBrowsingURL" width="250px"/>
          </el-table>
        </div>
      </div>

      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="handleUpdate()">全部上传</el-button>
          <el-button type="primary" @click="handleUpdateData()">基础数据上传</el-button>
          <el-button type="primary" @click="handleUpdateLab()">实验室检查数据上传</el-button>
          <el-button type="primary" @click="handleUpdateInspection()">检查数据上传</el-button>
          <el-button @click="closeDetailDialog_cl()">关 闭</el-button>
        </div>
      </template>
    </el-dialog>


  </div>
</template>

<script setup>
import { getOutPatList, addOutPatList } from "@/api/hospital/MrOutData";
import { updateOutPatList, MrOutData } from "@/api/hospital/MrOutData";
import { updateMrOutData } from "@/api/hospital/MrOutData";
import { handleUpdateData2,handleUpdateLab2,handleUpdateInspection2 } from "@/api/hospital/MrOutData";
const {proxy} = getCurrentInstance();
const {sys_normal_disable} = proxy.useDict("sys_normal_disable");
const { sys_user_sex, sys_card_type, sys_country, sys_nation, sys_occupation, sys_marriage, sys_in_hospital } = proxy.useDict("sys_user_sex", "sys_card_type", "sys_country", "sys_nation", "sys_occupation", "sys_marriage", "sys_in_hospital");
const { sys_region, sys_guanxi, sys_payment } = proxy.useDict("sys_region", "sys_guanxi", "sys_payment");
const { sys_diag_type, sys_yes_no } = proxy.useDict("sys_diag_type","sys_yes_no");
const { sys_abo, sys_rh, sys_consultation_subject, sys_outway, sys_mrout } = proxy.useDict("sys_abo", "sys_rh", "sys_consultation_subject","sys_outway","sys_mrout");

const total = ref(0);
const showSearch = ref(true);
const postList = ref([]);
const open = ref(false);
const title = ref("");
const loading = ref(true);
const ids = ref([]);
const imageUrl = ref('');
const subjectlist = ref([]);
const schoollist = ref([]);
const fdlist = ref([]);
const timeList = ref([]);
const formDetail = ref();
const open_cl = ref(false);
const mrOutBaisc = ref();
// const mrInRecord = ref();
const mrOutDiagnosss = ref();
const mrOutPhysicalsigns = ref();
const mrOutOrders = ref();
const mrInlab = ref();
const mrInspection = ref();
const data = reactive({
  form: {},
  xmlParams:{},
  mrOutRecord:{},
  queryParams: {
    pageNum: 1,
    pageSize: 100,
    orgId: undefined,
    patName: undefined,
    barCode: undefined
  },
  rules: {}
});
const { queryParams, form, rules, xmlParams, mrOutRecord } = toRefs(data);

function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}


function getList() {
  loading.value = true;
  getOutPatList(queryParams.value).then(response => {
    postList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}

function handleDetail(row){
  formDetail.value = row;
  addOutPatList(formDetail.value).then(response =>{
    formDetail.value = response.data;
  })
  open.value = true;
}

function handleOpenCl(row){
  xmlParams.value = row
  MrOutData(xmlParams.value).then(response =>{
    open_cl.value = true
    console.log(response)
    mrOutBaisc.value = response.data.mrOutData.mrOutBaisc;
    if(response.data.mrOutData.mrOutRecord !== null){
      console.log("mrOutRecord");
      mrOutRecord.value = response.data.mrOutData.mrOutRecord;
    }
    console.log("ceshi1")
    if(response.data.mrOutData.mrOutDiagnosss !== null){
      console.log("mrOutDiagnosss");
      mrOutDiagnosss.value = response.data.mrOutData.mrOutDiagnosss.mrOutDiagnossList.sort((a,b) => a.diagOrder - b.diagOrder);
    }
    console.log("ceshi2")
    if(response.data.mrOutData.mrOutPhysicalsigns !== null){
      console.log("mrOutPhysicalsigns");
      mrOutPhysicalsigns.value =  response.data.mrOutData.mrOutPhysicalsigns.mrOutPhysicalsignList;
    }
    console.log("ceshi3")
    if(response.data.mrOutData.mrOutOrders !== null){
      console.log("mrOutOrders");
      mrOutOrders.value = response.data.mrOutData.mrOutOrders.mrOutOrderList;
    }
    console.log("ceshi4")
    if(response.data.mrInLab !== null){
      console.log("mrInLab");
      mrInlab.value = response.data.mrInLab;
    }
    console.log("ceshi5")
    if(response.data.mrInspection !== null){
      console.log("mrInspection");
      mrInspection.value = response.data.mrInspection;
    }
  }).catch(response => {
    proxy.$modal.msgError(response.message);
  })
}


function closeDetailDialog(){
  open.value = false;
  formDetail.value = null;
}

function closeDetailDialog_cl(){
  open_cl.value = false
  mrOutBaisc.value = null
  mrOutRecord.value = null
  mrOutDiagnosss.value = null
  mrOutPhysicalsigns.value =  null
  mrOutOrders.value = null
  mrInlab.value = null
  mrInspection.value = null
}

function handleUpdate(){
  updateMrOutData(mrOutBaisc.value).then(response =>{
    proxy.$modal.msgSuccess(response.msg);
  })
}


//基础数据上传data
function handleUpdateData(){
  handleUpdateData2(mrOutBaisc.value).then(response =>{
    proxy.$modal.msgSuccess(response.msg);
  })
}
//实验室数据上传lab
function handleUpdateLab(){
  handleUpdateLab2(mrOutBaisc.value).then(response =>{
    proxy.$modal.msgSuccess(response.msg);
  })
}


//检查数据上传inspection
function handleUpdateInspection(){
  handleUpdateInspection2(mrOutBaisc.value).then(response =>{
    proxy.$modal.msgSuccess(response.msg);
  })
}


function handleDetailUpdate(){
  updateOutPatList(formDetail.value).then(response =>{
    proxy.$modal.msgSuccess(response.msg);
  })
}

getList();
</script>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
}

.avatar-uploader .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 100px;
  height: 100px;
  text-align: center;
}

.avatar{
  width: 100px;
  height: 100px;
}
.a4-paper {
  width: 794px; /* A4纸张宽度 */
  /*height: 1123px; !* A4纸张高度 *!*/
  margin: auto; /* 水平居中 */
  background-color: rgba(255, 255, 255, 0.06); /* 背景色，可根据需要调整 */
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* 可选，添加一些阴影效果 */
  padding: 20px; /* 内边距，根据需要调整 */
  /* 如果需要模拟打印页面的边距，可以进一步设置 */
  position: relative; /* 如果需要定位内部元素 */
  font-size: 6px;
}
.shuru {
  width: 50px;
  font-size: 5px;
  border: none;
  border-bottom: 1px solid #ccc;
}
</style>
